<template>
	<view class="home-detail-page">
		<TopBar
			left-icon="/static/user.png"
			scan-icon="/static/saoyisao.png"
			menu-icon="/static/menu.png"
			@menu="toggleMenu"
		/>

		<scroll-view scroll-y class="page-scroll">
			<!-- 标题行：Greenwear + 右侧3图标 -->
			<view class="title-row">
				<text class="brand">Greenwear</text>
				<view class="title-icons">
					<image src="/static/share.png" class="title-icon" />
					<image src="/static/bookmark.png" class="title-icon" />
					<image src="/static/mail.png" class="title-icon" />
				</view>
			</view>

			<!-- 卡片1：Basic Information -->
			<view class="card">
				<text class="card-title">Basic Information</text>
				<view class="bullet-list">
					<view class="bullet-item" v-for="(line, idx) in basicInfo" :key="idx">
						<view class="dot"></view>
						<text class="bullet-text">{{ line }}</text>
					</view>
				</view>
			</view>

			<!-- 卡片2：Certifications & Eco-score 图标 -->
			<view class="card">
				<text class="card-title">Certifications & Eco-score</text>
				<text class="card-sub">BSCI, GRS, ISO9001</text>
				<view class="icon-row">
					<image v-for="(src, i) in ecoIcons" :key="i" :src="src" class="eco-icon" mode="heightFix" />
				</view>
			</view>

			<!-- 卡片3：Capacity & Processes -->
			<view class="card">
				<text class="card-title">Capacity & Processes</text>
				<view class="bullet-list">
					<view class="bullet-item" v-for="(line, idx) in capacity1" :key="idx">
						<view class="dot"></view>
						<text class="bullet-text">{{ line }}</text>
					</view>
				</view>
			</view>

			<!-- 卡片4：Capacity & Processes -->
			<view class="card">
				<text class="card-title">Capacity & Processes</text>
				<view class="bullet-list">
					<view class="bullet-item" v-for="(line, idx) in capacity2" :key="idx">
						<view class="dot"></view>
						<text class="bullet-text">{{ line }}</text>
					</view>
				</view>
			</view>

			<!-- 卡片5：Catalogue -->
			<view class="card">
				<text class="card-title">Catalogue</text>
			<view class="catalog-row" @click="goOrderInfo">
					<image src="/static/paperclip.png" class="clip" />
					<text class="catalog-text">Public catalogue</text>
					<button class="mini-btn">download</button>
				</view>
				<view class="catalog-row" @click="goOrderInfo">
					<image src="/static/paperclip.png" class="clip" />
					<text class="catalog-text">Private catalogue</text>
					<button class="mini-btn outline">Request access</button>
				</view>
			</view>
		</scroll-view>

		<CustomTabbar active="home" />

		<AccountMenu
			v-if="showMenu"
			:style="{ '--anchor-top': '70px', '--anchor-right': '16px' }"
			@close="closeMenu"
			@select="closeMenu"
		/>
	</view>
</template>

<script setup>
import { ref } from 'vue';
import TopBar from '@/components/TopBar.vue';
import AccountMenu from '@/components/AccountMenu.vue';
import CustomTabbar from '@/components/CustomTabbar.vue';

const showMenu = ref(false);
const toggleMenu = () => { showMenu.value = !showMenu.value; };
const closeMenu = () => { showMenu.value = false; };

const basicInfo = ref([
	'Name: Greenwear',
	'Location: Portugal',
	'Year established: 2018',
	'Scale: 80 employees / 2,500 m² facility',
	'Website: www.greenwear.pt'
]);

const ecoIcons = ref([
	'/static/login/1.png',
	'/static/login/2.png',
	'/static/login/4.png',
	'/static/login/5.png'
]);

const capacity1 = ref([
	'Quality level: Premium / Luxury',
	'Design model: OEM, ODM',
	'Product categories: Sweaters, knitwear, outerwear',
	'Key clients: Sandro, Acne Studios, Isabel Marant'
]);

const capacity2 = ref([
	'Monthly capacity: 30,000 pcs',
	'Sampling capabilities: OEM,  ODM',
	'Lead time: 45–60 days after order confirmation',
	'Delivery terms: FOB'
]);

const goOrderInfo = () => {
    uni.navigateTo({ url: '/pages/home/order-info' });
};
</script>

<style lang="scss">
.home-detail-page { min-height: 100vh; background: linear-gradient(180deg, #d9f0ff 0%, #e9f9ed 100%); }
.page-scroll { margin-top: 60px; padding: 0 0 84px 0; box-sizing: border-box; }

.title-row { margin: 8px 0 12px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.brand { font-size: 22px; font-weight: 800; color: #0b1e2a; }
.title-icons { display: flex; gap: 12px; }
.title-icon { width: 20px; height: 20px; }

.card { background: #eff7f8; border-radius: 14px; box-shadow: 0 6px 16px rgba(0,0,0,.12), 10px 0 16px rgba(0,0,0,.12); padding: 14px; margin: 0 16px 12px 16px; }
.card-title { display: block;font-size: 16px; font-weight: 700; color: #0b1e2a; margin-bottom: 10px; }
.card-sub { color: #0b1e2a; margin-bottom: 8px; display: block; }

.bullet-list { display: flex; flex-direction: column; gap: 8px; }
.bullet-item { display: flex; align-items: flex-start; gap: 8px; }
.dot { width: 6px; height: 6px; background: #0b1e2a; border-radius: 50%; margin-top: 6px; }
.bullet-text { color: #0b1e2a; font-size: 14px; line-height: 20px; }

.icon-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 6px 2px; }
.eco-icon { height: 42px; width: auto; }

.catalog-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; width: 100%; }
.clip { width: 16px; height: 16px; }
.catalog-text { color: #0b1e2a; font-size: 14px; }
.mini-btn { margin-left: auto; margin-right: 0; height: 32px; padding: 0 12px; background: #222; color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.mini-btn.outline { background: #222; color: #fff; border: none; }
</style>


